package hierarchydisplay;

import java.awt.Graphics;

import shapes.Connector;
import shapes.StraightConnector;

public class Connection {
	protected ICompositeNode parent;
	protected INode child;
	protected Connector connShape;
	
	/* initialize connection bewtween given nodes */
	public Connection(ICompositeNode parent, INode child) {
		this.parent = parent;
		this.child = child;	
		initShape();
	}
	
	/* draw connection */
	public void draw(Graphics g) {
		connShape.draw(g);
	}
	
	/* initialize connection shape */
	protected void initShape() {
		connShape = new StraightConnector(
				parent.getShape(), 
				child.getShape());
	}

}
